@using BTCPayServer.Plugins.Emails.Services
@model ForgotPasswordViewModel
@inject EmailSenderFactory EmailSenderFactory
@{
	var isEmailConfigured = await EmailSenderFactory.IsComplete();
	ViewData["Title"] = isEmailConfigured ? "Forgot your password?" : "Email Server Configuration Required";
    Layout = "_LayoutSignedOut";
}

@if (isEmailConfigured)
{
    <p text-translate="true">We all forget passwords sometimes. Just provide email address tied to your account, and we'll start the process of helping you recover your account.</p>

    <form asp-action="ForgotPassword" method="post">
        @if (!ViewContext.ModelState.IsValid)
        {
            <div asp-validation-summary="All" class="@(ViewContext.ModelState.ErrorCount.Equals(1) ? "no-marker" : "")"></div>
        }
        <div class="form-group">
            <label asp-for="Email" class="form-label"></label>
            <input asp-for="Email" class="form-control" />
            <span asp-validation-for="Email" class="text-danger"></span>
        </div>
        <div class="form-group mt-4">
            <button id="page-primary" type="submit" class="btn btn-primary btn-lg w-100" text-translate="true">Submit</button>
        </div>
    </form>
}
else
{
    <p text-translate="true">Email password reset functionality is not configured for this server. Please contact the server administrator to assist with account recovery.</p>
    <p>
        If you are the administrator, please follow these steps to
        <a href="https://docs.btcpayserver.org/Notifications/#smtp-email-setup" target="_blank" rel="noreferrer noopener">configure email password resets</a>
        or reset your admin password through
        <a href="https://docs.btcpayserver.org/FAQ/ServerSettings/#forgot-btcpay-admin-password" target="_blank" rel="noreferrer noopener">command line</a>.
    </p>
}

<p class="text-center mt-2 mb-0">
    <a id="Login" style="font-size:1.15rem" asp-action="Login" asp-route-returnurl="@ViewData["ReturnUrl"]" text-translate="true">Log in</a>
</p>
